package dkbta.ontology.elements.pattern.conditions;

import dkbta.ontology.elements.Element;
import dkbta.ontology.values.DurationValues;

public class DurationCondition{
	/** The duration values the constraint imposes */
	private DurationValues _validDuration;

	public DurationCondition(DurationValues validDuration){
		_validDuration = validDuration;
	}

	/**
	 * Checks whether a certain instance conforms to the constraint
	 * 
	 * @param e The instance
	 * @return Whether the certain instance conforms to the constraint
	 */
	public boolean checkCondition(Element e){
		return _validDuration.isValid(e.getTimeInterval().getDuration());
	}

	/**
	 * Returns a string representation of the constraint
	 * 
	 * @return A string representation of the constraint
	 */
	@Override
	public String toString(){
		return _validDuration.toString();
	}
}
